<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:a4j="http://richfaces.org/a4j"
	xmlns:rich="http://richfaces.org/rich"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:sijyp="http://java.sun.com/jsf/composite/sijyp"
	template="#{bienManager.vincularHechoMode ? '/templates/simpleTemplate.xhtml' : '/templates/template.xhtml'}">
	<ui:define name="body">
		<rich:panel id = "pnlCadaverMainPanel" style="width:100%">
			<f:facet name="header">
				#{msgExh['exhumaciones.diligencia.cadaver.consulta']}
			</f:facet>

			<h:form id="frm">
			
			<a4j:region id="rg_caso_filtro">
			
				<f:event type="javax.faces.event.PreRenderComponentEvent"
					listener="#{consultarCadaver.viewHandler}" />
					
				<h:panelGroup id="consulta_cadaver_filtros" layout="block">
					#{msgExh['exhumaciones.diligencia.cadaver.consulta']}
					<hr width="100%" />
					<br />
					<h:panelGrid columns="3" columnClasses="col33,col33,col33"
						width="80%">

						<h:panelGrid>
							<h:outputLabel id="lbl_id"
								value="#{msgExh['exhumaciones.diligencia.id_caso']}:" />
							<h:inputText id="id_caso" 
								disabled="false" 
								maxlength="21"
								validatorMessage="${msg['general.formatoNoValido']}"
								value="#{consultarCadaver.dto.numeroCaso}">
								<f:validateRegex pattern="/?\d+/?\d*"/>								
							</h:inputText>
							<rich:message for="id_caso" showDetail="false" showSummary="true" styleClass="validationErrorMessage"/>
						</h:panelGrid>

						<h:panelGrid>
							<h:outputLabel id="lbl_numero_interno"
								value="#{msgExh['exhumaciones.diligencia.cadaver.numero_interno']}:" />
							<h:inputText id="numero_interno" 
								disabled="false" maxlength="20"
								value="#{consultarCadaver.dto.numeroInterno}">
							</h:inputText>
							<rich:message for="numero_interno" showDetail="false" showSummary="true" styleClass="validationErrorMessage"/>
						</h:panelGrid>

						<h:column />
					</h:panelGrid>

					<h:panelGrid columns="3" columnClasses="col33,col33,col33"
						width="80%">
						<h:panelGrid>
							<h:outputLabel id="lbl_estado_cadaver"
								value="#{msgExh['exhumaciones.diligencia.cadaver.estado_cadaver']}:" />
							<h:selectOneMenu id="estado_cadaver"
								value="#{consultarCadaver.dto.idEstadoEntrCuerpo}">
								<f:selectItem itemLabel="Seleccione ..." itemValue="#{null}"
									noSelectionOption="true" />
								<f:selectItems value="#{consultarCadaver.helper.estadosEntrCuerpos}" />
							</h:selectOneMenu>
						</h:panelGrid>
						<h:column />
						<h:column />
					</h:panelGrid>

					<ui:remove><h:panelGrid style="margin-top:10px;margin-bottom:10px;">
						<sijyp:personasField prefixId="consultaCadaver"
							label="#{msgExh['exhumaciones.diligencia.cadaver.nombre_cadaver']}"
							value="#{consultarCadaver.dto.persona.nombre}"
							dto="#{consultarCadaver.dto.persona}"
							styleClass="long longPersona" disabled="false" />
					</h:panelGrid></ui:remove>
					
					<br />
					#{msgExh['exhumaciones.diligencia.cadaver.nombre_cadaver']}:
					
					 <h:panelGrid columns="4" columnClasses="col25,col25,col25,col25"
						width="100%">
						<h:panelGrid>
							<h:outputLabel value="Primer Nombre:" />
							<h:inputText id="primerNombre" 
								value="#{consultarCadaver.dto.personaConsulta.primerNombre}">
								<f:validateLength maximum="50" />
							</h:inputText>
							<rich:message for="primerNombre" />
						</h:panelGrid>
			
						<h:panelGrid>
							<h:outputLabel value="Segundo Nombre:" />
							<h:inputText id="segundoNombre"
								value="#{consultarCadaver.dto.personaConsulta.segundoNombre}">
								<f:validateLength maximum="50" />
							</h:inputText>
							<rich:message for="segundoNombre" />
						</h:panelGrid>
			
						<h:panelGrid>
							<h:outputLabel value="Primer Apellido:" />
							<h:inputText id="primerApellido"
								value="#{consultarCadaver.dto.personaConsulta.primerApellido}">
								<f:validateLength maximum="50" />
							</h:inputText>
							<rich:message for="primerApellido" />
						</h:panelGrid>
			
						<h:panelGrid>
							<h:outputLabel value="Segundo Apellido:" />
							<h:inputText id="segundoApellido"
								value="#{consultarCadaver.dto.personaConsulta.segundoApellido}">
								<f:validateLength maximum="50" />
							</h:inputText>
							<rich:message for="segundoApellido" />
						</h:panelGrid>
						<h:column />
						<h:panelGrid>
							<h:outputLabel value="Número de documento:" />
							<h:inputText id="numeroDocumento"
								value="#{consultarCadaver.dto.personaConsulta.numeroIdentificacion}">
								<f:validateLength maximum="20" />
							</h:inputText>
							<rich:message for="numeroDocumento" />
						</h:panelGrid>
						<h:panelGrid>
							<h:outputLabel value="Alias:" />
							<h:inputText id="alias"
								value="#{consultarCadaver.dto.personaConsulta.alias}">
								<f:validateLength maximum="150" />
							</h:inputText>
							<rich:message for="alias" />
						</h:panelGrid>
			        				
						<h:column />
					</h:panelGrid>


					<h:panelGrid columns="3" columnClasses="col33,col33,col33"
						width="80%">
						<ui:remove>
						<h:panelGrid>
							<h:outputLabel id="lbl_tipo_documento"
								value="#{msgExh['exhumaciones.catalogo.tipo_documento']}:" />
							<h:selectOneMenu id="tipo_documento" disabled="true"
								value="#{consultarCadaver.dto.persona.idTipoDocumentoDeIdentidad}">
								<f:selectItem itemLabel="Seleccione ..." itemValue="#{null}"
									noSelectionOption="true" />
								<f:selectItems
									value="#{consultarCadaver.helper.tiposDocumentos}" />
							</h:selectOneMenu>
						</h:panelGrid>

						<h:panelGrid>
							<h:outputLabel id="lbl_numero_documento"
								value="#{msgExh['exhumaciones.diligencia.num_documento']}:" />
							<h:inputText id="numero_documento" disabled="true"
								value="#{consultarCadaver.dto.persona.numeroIdentificacion}">
							</h:inputText>
						</h:panelGrid>

						<h:panelGrid>
							<h:outputLabel id="lbl_alias" value="#{msgExh['exhumaciones.alias']}:" />
							<h:inputText id="alias" disabled="true"
								value="#{consultarCadaver.dto.persona.alias}">
							</h:inputText>
						</h:panelGrid>
						</ui:remove>

					<h:panelGrid>
							<h:outputLabel id="lbl_pais" value="#{msgExh['exhumaciones.catalogo.pais']}:" />
							<h:selectOneMenu id="pais" disabled="true"
								value="#{consultarCadaver.dto.idPais}">
								<f:selectItem itemLabel="Seleccione ..." itemValue="#{null}"
									noSelectionOption="true" />
								<f:selectItems value="#{consultarCadaver.helper.paises}" />
								<f:ajax event="change" render="departamento municipio"
									execute="@this" />
							</h:selectOneMenu>

						</h:panelGrid>
						<h:panelGrid>
							<h:outputLabel id="lbl_departamento"
								value="#{msgExh['exhumaciones.catalogo.departamento']}:" />
							<h:selectOneMenu id="departamento"
								value="#{consultarCadaver.dto.idDepartamento}"
								valueChangeListener="#{consultarCadaver.listener.departamentoValueChange}">
								<f:selectItem itemLabel="Seleccione ..." itemValue="#{null}"
									noSelectionOption="true" />
								<f:ajax event="change" render="municipio" execute="@this" />
							</h:selectOneMenu>

						</h:panelGrid>
						<h:panelGrid>
							<h:outputLabel id="lbl_municipio"
								value="#{msgExh['exhumaciones.catalogo.municipio']}:" />
							<h:selectOneMenu id="municipio"
								value="#{consultarCadaver.dto.idMunicipio}">
								<f:selectItem itemLabel="Seleccione ..." itemValue="#{null}"
									noSelectionOption="true" />
							</h:selectOneMenu>

						</h:panelGrid>

					</h:panelGrid>
				</h:panelGroup>
				<br />

				<h:panelGrid id="pnl_btn_consultas" style="width:70%;">
					<h:panelGroup style="text-align:center;" layout="block">
						<h:commandButton id="btn_consultar" value="#{msgExh['exhumaciones.consultar']}"
							action="#{consultarCadaver.consultar()}">
							<!-- <f:ajax render="dt frm" execute="@form" /> -->
							<a4j:ajax render="dt pnl_btn_consultas" execute="@region" />
						</h:commandButton>
						<h:commandButton id="btn_cancelar" value="#{msgExh['exhumaciones.cancelar']}"
							action="#{consultarCadaver.cancelar()}">
							<f:ajax render=":detallesForm :detalle :frm" execute="@this"
								immediate="true" />
						</h:commandButton>
					</h:panelGroup>
				</h:panelGrid>
			</a4j:region>
				<br />

				<a4j:region id="datatable_consulta_cadaver">
					<rich:dataTable id="dt" keepSaved="true" var="record"
						noDataLabel="${msg['general.registrosNoEncontrados']}"
						value="#{consultarCadaver.cadaveresConsulta.dataModel}" rows="10"
						rendered="#{consultarCadaver.cadaveresConsulta != null}"
						binding="#{consultarCadaver.tabla}">
						<ui:include src="/resources/sijyp/dataModels/column.xhtml">
							<ui:param name="render_sort" value="dt" />
							<ui:param name="key" value="numero_caso" />
							<ui:param name="header"
								value="#{msgExh['exhumaciones.diligencia.num_caso']}" />
							<ui:param name="column" value="15" />
							<ui:param name="managedBean"
								value="#{consultarCadaver.cadaveresConsulta}" />
						</ui:include>

						<ui:include src="/resources/sijyp/dataModels/column.xhtml">
							<ui:param name="render_sort" value="dt" />
							<ui:param name="key" value="numero_fosa" />
							<ui:param name="header"
								value="#{msgExh['exhumaciones.diligencia.registrar.resultado.exhumacion.fosa.numero']}" />
							<ui:param name="column" value="1" />
							<ui:param name="managedBean"
								value="#{consultarCadaver.cadaveresConsulta}" />
						</ui:include>

						<ui:include src="/resources/sijyp/dataModels/column.xhtml">
							<ui:param name="render_sort" value="dt" />
							<ui:param name="key" value="numero_acta" />
							<ui:param name="header"
								value="#{msgExh['exhumaciones.informes.laboratorio.numero_acta']}" />
							<ui:param name="column" value="2" />
							<ui:param name="managedBean"
								value="#{consultarCadaver.cadaveresConsulta}" />
						</ui:include>

						<ui:include src="/resources/sijyp/dataModels/column.xhtml">
							<ui:param name="render_sort" value="dt" />
							<ui:param name="key" value="estadoentregacadaver" />
							<ui:param name="header"
								value="#{msgExh['exhumaciones.diligencia.cadaver.estado']}" />
							<ui:param name="column" value="12" />
							<ui:param name="managedBean"
								value="#{consultarCadaver.cadaveresConsulta}" />
						</ui:include>

						<ui:include src="/resources/sijyp/dataModels/column.xhtml">
							<ui:param name="render_sort" value="dt" />
							<ui:param name="key" value="identidad_plena_sn" />
							<ui:param name="header"
								value="#{msgExh['exhumaciones.diligencia.cadaver.posible_ident_sn']}" />
							<ui:param name="column" value="13" />
							<ui:param name="managedBean"
								value="#{consultarCadaver.cadaveresConsulta}" />
						</ui:include>

						<ui:include src="/resources/sijyp/dataModels/column.xhtml">
							<ui:param name="render_sort" value="dt" />
							<ui:param name="key" value="nombre_cadaver" />
							<ui:param name="header"
								value="#{msgExh['exhumaciones.diligencia.cadaver.nombre_cadaver']}" />
							<ui:param name="column" value="3" />
							<ui:param name="managedBean"
								value="#{consultarCadaver.cadaveresConsulta}" />
						</ui:include>

						<ui:include src="/resources/sijyp/dataModels/column.xhtml">
							<ui:param name="render_sort" value="dt" />
							<ui:param name="key" value="tipo_documento" />
							<ui:param name="header"
								value="#{msgExh['exhumaciones.catalogo.tipo_documento']}" />
							<ui:param name="column" value="4" />
							<ui:param name="managedBean"
								value="#{consultarCadaver.cadaveresConsulta}" />
						</ui:include>

						<ui:include src="/resources/sijyp/dataModels/column.xhtml">
							<ui:param name="render_sort" value="dt" />
							<ui:param name="key" value="numero_documento" />
							<ui:param name="header"
								value="#{msgExh['exhumaciones.diligencia.num_documento']}" />
							<ui:param name="column" value="5" />
							<ui:param name="managedBean"
								value="#{consultarCadaver.cadaveresConsulta}" />
						</ui:include>

						<ui:include src="/resources/sijyp/dataModels/column.xhtml">
							<ui:param name="render_sort" value="dt" />
							<ui:param name="key" value="alias" />
							<ui:param name="header" value="#{msgExh['exhumaciones.alias']}" />
							<ui:param name="column" value="6" />
							<ui:param name="managedBean"
								value="#{consultarCadaver.cadaveresConsulta}" />
						</ui:include>

						<ui:include src="/resources/sijyp/dataModels/column.xhtml">
							<ui:param name="render_sort" value="dt" />
							<ui:param name="key" value="pais" />
							<ui:param name="header"
								value="#{msgExh['exhumaciones.catalogo.pais']}" />
							<ui:param name="column" value="7" />
							<ui:param name="managedBean"
								value="#{consultarCadaver.cadaveresConsulta}" />
						</ui:include>

						<ui:include src="/resources/sijyp/dataModels/column.xhtml">
							<ui:param name="render_sort" value="dt" />
							<ui:param name="key" value="departamento" />
							<ui:param name="header"
								value="#{msgExh['exhumaciones.catalogo.departamento']}" />
							<ui:param name="column" value="8" />
							<ui:param name="managedBean"
								value="#{consultarCadaver.cadaveresConsulta}" />
						</ui:include>


						<ui:include src="/resources/sijyp/dataModels/column.xhtml">
							<ui:param name="render_sort" value="dt" />
							<ui:param name="key" value="municipio" />
							<ui:param name="header"
								value="#{msgExh['exhumaciones.catalogo.municipio']}" />
							<ui:param name="column" value="9" />
							<ui:param name="managedBean"
								value="#{consultarCadaver.cadaveresConsulta}" />
						</ui:include>

						<rich:column>
							<f:facet name="header">
								<h:outputLabel value="${msgExh['exhumaciones.acciones']}" />
							</f:facet>
							
							<h:panelGrid columns="5" columnClasses="icon_space,icon_space,icon_space,icon_space,icon_space">
								<h:commandLink id="btn_registrar_cadaver" value="" onclick="#{rich:component('loadingStatusModal')}.show()"
									action="#{consultarCadaver.registrarCadaveres(record[14],record[0])}"
									immediate="true" disabled="false">
									<h:graphicImage value="/resources/images/icons/ico_gestion_cadaver.png"
										title="${msgExh['exhumaciones.diligencia.registrar.resultado.exhumacion.registrar_cadaveres']}" />
								</h:commandLink>
								<h:commandLink id="btn_registrar_informe" value="" onclick="#{rich:component('loadingStatusModal')}.show()"
									action="#{consultarCadaver.registrarInformesLaboratorio(record[0],record[1],record[2],record[10])}"
									immediate="true" disabled="#{record[11] != 'EXHUMADO'}">
									<h:graphicImage value="/resources/images/icons/ico_info_laborat_cadaver_gray.png"
										rendered="#{record[11] != 'EXHUMADO'}"
										title="${msgExh['exhumaciones.informes.laboratorio.carga']}" />
									<h:graphicImage value="/resources/images/icons/ico_info_laborat_cadaver.png"
										rendered="#{record[11] == 'EXHUMADO'}"
										title="${msgExh['exhumaciones.informes.laboratorio.carga']}" />
								</h:commandLink>
								<h:commandLink id="btn_registrar_traslado" value="" onclick="#{rich:component('loadingStatusModal')}.show()"
									action="#{consultarCadaver.registrarTraslados(record[0],record[1],record[2],record[10])}"
									immediate="true" disabled="#{record[11] != 'EXHUMADO'}">
									<h:graphicImage value="/resources/images/icons/ico_traslado_cadaver_gray.png"
										rendered="#{record[11] != 'EXHUMADO'}"
										title="${msgExh['exhumaciones.diligencias.cadaver_traslado']}" />
									<h:graphicImage value="/resources/images/icons/ico_traslado_cadaver.png"
										rendered="#{record[11] == 'EXHUMADO'}"
										title="${msgExh['exhumaciones.diligencias.consulta.cadaver_traslado']}" />
								</h:commandLink>
								<h:commandLink id="btn_registrar_identidad" value="" onclick="#{rich:component('loadingStatusModal')}.show()"
									action="#{consultarCadaver.registrarIdentidadPlena(record[0],record[1],record[2],record[10])}"
									immediate="true" disabled="#{record[11] != 'EXHUMADO'}">
									<h:graphicImage value="/resources/images/icons/ico_identidad_plena_gray.png"
										rendered="#{record[11] != 'EXHUMADO'}"
										title="${msgExh['exhumaciones.diligencias.cadaver_identidad']}" />
									<h:graphicImage value="/resources/images/icons/ico_identidad_plena.png"
										rendered="#{record[11] == 'EXHUMADO'}"
										title="${msgExh['exhumaciones.diligencias.consulta.cadaver_identidad']}" />
								</h:commandLink>
								<h:commandLink id="btn_entregar_cadaver" value="" onclick="#{rich:component('loadingStatusModal')}.show()"
									action="#{consultarCadaver.entregarCadaver(record[0],record[1],record[2],record[10],record[11])}"
									immediate="true" disabled="#{record[11] != 'EXHUMADO'}">
									<h:graphicImage value="/resources/images/icons/ico_entrega_cadaver_gray.png"
										rendered="#{record[11] != 'EXHUMADO'}"
										title="${msgExh['exhumaciones.diligencias.consulta.cadaver_entrega']}" />
									<h:graphicImage value="/resources/images/icons/ico_entrega_cadaver.png"
										rendered="#{record[11] == 'EXHUMADO'}"
										title="${msgExh['exhumaciones.diligencias.consulta.cadaver_entrega']}" />
								</h:commandLink>
							</h:panelGrid>
						</rich:column>

						<f:facet name="footer">
							<rich:dataScroller   maxPages="10"
								fastStep="5"
								fastControls="hide" stepControls="show">
							</rich:dataScroller>
						</f:facet>
					</rich:dataTable>
				</a4j:region>
			</h:form>

		</rich:panel>
		<ui:include src="../solicitud/popupsPersona.xhtml" />
	</ui:define>
</ui:composition>
